<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>二进制转十六进制数字, 并解释十六进制的计算原理</title>
</head>
<body>
  <script>
    function fn(num) {
      var sum = parseInt(num, 2) // 二进制转十进制
      // console.log(sum)
      return sum.toString(16)  // 十进制转十六进制
    }
    console.log(fn(1111))
  </script>
</body>
</html>